<template>
  <a-card :bordered="false">


    <div class="table-operator">
      <a-button type="primary" icon="plus" @click="$refs.save.addPlus(tableData)">新建</a-button>
    </div>
    <a-table
      key="loading"
      v-if="loading"
    >
      <a-table-column title="目录名称" dataIndex="menuName" key="menuName"/>
      <a-table-column title="前端路由" dataIndex="routerUrl" key="routerUrl"/>
      <a-table-column title="目录图标" dataIndex="menuIcon" key="menuIcon"/>
      <a-table-column title="组件名称" dataIndex="componentName" key="componentName"/>
      <a-table-column title="优先级" dataIndex="priority" key="priority"/>
      <a-table-column title="类型" dataIndex="type" key="type"/>
      <a-table-column title="权限码" dataIndex="permsCode" key="permsCode"/>
      <a-table-column title="操作">
        <template slot-scope="record">
        <span>
          <a href="javascript:;">编辑</a>
          <a-divider type="vertical"/>
         <a href="javascript:;">删除</a>
        </span>
        </template>
      </a-table-column>
    </a-table>


    <a-table
      key="noLoading"
      v-if="!loading"
      :rowKey=" (record => record.id)"
      :dataSource="tableData"
      :loading="loading"
      :defaultExpandAllRows="true"
    >
      <a-table-column title="目录名称" dataIndex="menuName" key="menuName"/>
      <a-table-column title="前端路由" dataIndex="routerUrl" key="routerUrl"/>
      <a-table-column title="目录图标" dataIndex="menuIcon" key="menuIcon"/>
      <a-table-column title="组件名称" dataIndex="componentName" key="componentName"/>
      <a-table-column title="优先级" dataIndex="priority" key="priority"/>
      <a-table-column title="类型" dataIndex="type" key="type"/>
      <a-table-column title="权限码" dataIndex="permsCode" key="permsCode"/>

      <a-table-column title="操作">
        <template slot-scope="record">
        <span>
          <a href="javascript:;" @click="$refs.save.editPlus(record,tableData)">编辑</a>
          <a-divider type="vertical"/>
            <a-popconfirm title="确定删除吗？" @confirm="handleDelete(record)">
                 <a-icon slot="icon" type="question-circle-o" style="color: red"/>
                <a href="javascript:;">删除</a>
             </a-popconfirm>
        </span>
        </template>
      </a-table-column>
    </a-table>

    <save ref="save" @refresh="refresh"></save>
  </a-card>
</template>


<script>
  import save from './save/save'
  import listMixins from '../../../common/mixins/listMixins'
  import { selectMenuList,deleteById } from '../../../api/base/menu'
  export default {
    name: 'permission',
    mixins: [listMixins],
    components: {
      save
    },
    data(){
      return{
      }
    },
    methods: {
      getList(param) {
        return selectMenuList(param)
      },
      delete(param){
        return deleteById(param)
      },

    }
  }
</script>

<style scoped>

</style>